package com.kvest.gps_tracker.datamodel;

import android.location.Location;
import android.location.LocationManager;

public class GPSPoint 
{
	public static final int PROVIDER_GPS = 0;
	public static final int PROVIDER_GSM = 1;
	
	public static int COUNTER = 1; 
	
	private int id;
	private long time;
	private double longitude;
	private double latitude;
	private double altitude;
	private float speed;
	private float azimuth;
	private int provider;
	
	public GPSPoint()
	{
		id = COUNTER++;
		time = 0;
		longitude = 0;
		latitude = 0;
		altitude = 0;
		speed = 0;
		azimuth = 0;
		provider = PROVIDER_GPS;
	}
	
	public GPSPoint(Location location)
	{
		id = COUNTER++;
		time = location.getTime() / 1000L;
		longitude = location.getLongitude();
		latitude = location.getLatitude();
		altitude = location.getAltitude();
		speed = location.getSpeed();
		azimuth = location.getBearing();
		if (location.getProvider() == LocationManager.GPS_PROVIDER)
		{
			provider = PROVIDER_GPS;
		}
		else if (location.getProvider() == LocationManager.NETWORK_PROVIDER)
		{
			provider = PROVIDER_GSM;
		}
		else
		{
			provider = PROVIDER_GPS;
		}
	}
	
	public int getId() 
	{
		return id;
	}

	public void setId(int id) 
	{
		this.id = id;
	}

	public int getProvider() 
	{
		return provider;
	}

	public void setProvider(int provider) 
	{
		this.provider = provider;
	}

	public long getTime()
	{
		return time;
	}

	public void setTime(long time) 
	{
		this.time = time;
	}

	public double getLongitude() 
	{
		return longitude;
	}

	public void setLongitude(double longitude) 
	{
		this.longitude = longitude;
	}

	public double getLatitude() 
	{
		return latitude;
	}

	public void setLatitude(double latitude)
	{
		this.latitude = latitude;
	}

	public double getAltitude()
	{
		return altitude;
	}

	public void setAltitude(double altitude) 
	{
		this.altitude = altitude;
	}

	public float getSpeed() 
	{
		return speed;
	}

	public void setSpeed(float speed) 
	{
		this.speed = speed;
	}

	public float getAzimuth() 
	{
		return azimuth;
	}

	public void setAzimuth(float azimuth) 
	{
		this.azimuth = azimuth;
	}
	
	
}
